Queries involving the joining of multiple tables in a database system are known in the art. For example, if a query includes a WHERE clause predicate and filtering occurs at more than one table, more rows than necessary may be joined between two or more tables before the filter is applied. The WHERE clause specifies an intermediate result table that includes those rows of a table for which the search condition is true. This is inefficient.
For example, assume a 10 table join. If each table has predicates that perform some level of filtering, then the first table may return 100,000 rows (after filtering is applied to this table), the second table filters out 20%, the third a further 20%, etc. If each table (after the first) provide 20% filtering, then the final result is approximately 13,000 rows for a 10 table join. Therefore, approximately 87,000 unnecessary rows are joined between tables 2 and 3, 67,000 between tables 3 and 4, etc.
Accordingly, there exists a need for an improved method for processing multiple table queries. The improved method should derive predicates based on a join relationship between tables and apply these derived predicates to tables earlier in the join sequence. The present invention addresses such a need.